import { defAxios as request } from '@/utils/http'

/**
 * 获取菜单全部数据接口
 * @returns 菜单全部数据
 */
export function getMenuSource(params) {
  return request({
    url: '/menu/getMenuAll',
    method: 'GET',
    params
  })
}

/**
 * 获取菜单管理数据接口
 * @returns 菜单数据
 */
export function getMenuList(params) {
  return request({
    url: '/menu/index',
    method: 'GET',
    params
  })
}

/**
 * 添加菜单
 * params
 */
export function menuCreate(data) {
  return request({
    url: '/menu/add',
    method: 'POST',
    data
  })
}

/**
 * 编辑菜单
 * params
 */
export function menuUpdate(data) {
  return request({
    url: '/menu/edit',
    method: 'PUT',
    data
  })
}

/**
 * 删除菜单
 * params
 */
export function deleteMenu(id) {
  return request({
    url: `/menu/delete/${id}`,
    method: 'DELETE'
  })
}

/**
 * 添加小程序菜单
 * params
 */
export function mpMenuCreate(data) {
  return request({
    url: '/apiMenu/add',
    method: 'POST',
    data
  })
}

/**
 * 编辑小程序菜单
 * params
 */
export function mpMenuUpdate(data) {
  return request({
    url: '/apiMenu/edit',
    method: 'PUT',
    data
  })
}

/**
 * 删除小程序菜单
 * params
 */
export function deleteMpMenu(id) {
  return request({
    url: `/apiMenu/delete/${id}`,
    method: 'DELETE'
  })
}

/**
 * 添加权限
 * params
 */
export function permissionCreate(data) {
  return request({
    url: '/permission/add',
    method: 'POST',
    data
  })
}

/**
 * 编辑权限
 * params
 */
export function permissionUpdate(data) {
  return request({
    url: '/permission/edit',
    method: 'PUT',
    data
  })
}

/**
 * 删除权限
 * params
 */
export function deletePermission(ids) {
  return request({
    url: `/permission/delete/${ids}`,
    method: 'DELETE'
  })
}
